SpatialStream® Code Examples

Pushpin Above WMS Layer

Creating a Map Layer Object and adding it to the map is the SpatialStream® recommended method.
The example below shows how to construct a Map Layer Object to add a Parcel layer (WMS) to the map.
The Map Layer Object constructs the GetMap requests which retrieve the images for overlaying on the map.
This sample demonstrates the use of the Bing Maps Cluster layer so that the pushpins are on top of the WMS layer.
GetMap

// layer for zoom level 20
parcelLayer = new Dmp.Layer.WMSLayer("Parcelwms", "SS", {
antiAlias: true
});
parcelLayer.addChild("Parcels", "SS.Base.Parcels/Parcels", "SS.Base.Parcels.Styles.Parcels/Default.sld.xml", {
zIndex: 2, zoomRange: {
min: 20, max: 20
}
});
map.addEntity(parcelLayer);

// precached tiles from zoom level 14 - 19
layer = new Dmp.Layer.TileLayer("ParcelTiles", "SS", {
antiAlias: true
});
layer.addChild("Parcels", "SS.Base.Parcels/ParcelTiles", "", {
zIndex: 2, zoomRange: {
min: 14, max: 19
}
});
map.addEntity(layer);


// add the label layer
labelLayer = new Dmp.Layer.WMSLayer("ParcelWMSLabels", "SS", {
antiAlias: true
});
labelLayer.addChild("Parcels", "SS.Base.Parcels/Parcels", "SS.Base.Parcels.Styles.Parcels/Labels.sld.xml", {
zoomRange: {
min: 18, max: 20
}
});
map.addEntity(labelLayer);

Microsoft.Maps.loadModule('Microsoft.Maps.Clustering', function () {

// Creating sample Pushpin data within map view
var pushpins = Microsoft.Maps.TestDataGenerator.getPushpins(100, map.getBounds());
var clusterLayer = new Microsoft.Maps.ClusterLayer(pushpins, {
gridSize: 1
});
map.layers.insert(clusterLayer);
});


Run Sample   Back To Index